import request from '@/utils/request'
import { checkPhoneNum, checkInteger2 } from '@/utils/validate'

// 列表配置项
export const column = [
  {
    label: "id",
    prop: "id",
    tooltip: "表头提示"
  },
  {
    label: "万元工业增加值用水量(万m³)",
    children: [
      {
        label: "实际",
        prop: "industryAddedWaterAct",
        width: "100px",
      },
      {
        label: "目标",
        prop: "industryAddedWaterPre",
        width: "100px",
      },
    ],
  },
  {
    label: "图片",
    prop: "slot",
    slotName: "id",
  },
  {
    label: "微信名",
    prop: "wxName",
  },
  {
    label: "手机号",
    prop: "phone",
  },
  {
    label: "微信openid",
    prop: "openid",
  },
  {
    label: "注册时间",
    prop: "slot",
  },
  {
    label: "企业",
    prop: "enterprise",
  },
  {
    label: "职位",
    prop: "wxPro",
  },
  {
    label: "统一社会信用代码",
    prop: "xyCode",
  },
  {
    label: "真实姓名",
    prop: "realName",
  },
  {
    label: "性别",
    prop: "genderName",
  },
  {
    label: "生日",
    prop: "birthday",
  },
];

// 查询表单配置项
export const searchFormConfig = [
  // tabs切换
  {
    type: "slotName",
    slotName: "tabsSlot",
    span: 24,
  },
  // form表单
  {
    label: "专家姓名",
    prop: "specialistName",
    type: "text",
    maxlength: 10,
    span: 6
  },
  {
    label: "手机号",
    prop: "specialistPhone",
    type: "text",
    maxlength: 13,
    span: 6
  },
  {
    label: "服务区域",
    prop: "SERVD",
    type: "defaultCascader",
    options: [
      {
        "id": "1",
        "parentId": "0",
        "country": "南宁市",
        "latitude": null,
        "longitude": null,
        "children": [
          {
            "id": "1001",
            "parentId": "1",
            "country": "兴宁区",
            "latitude": "22.857452",
            "longitude": "108.324052"
          },
          {
            "id": "1002",
            "parentId": "1",
            "country": "青秀区",
            "latitude": "22.819611",
            "longitude": "108.371708"
          },
          {
            "id": "1003",
            "parentId": "1",
            "country": "江南区",
            "latitude": "22.779909",
            "longitude": "108.274538"
          },
          {
            "id": "1004",
            "parentId": "1",
            "country": "西乡塘区",
            "latitude": "22.856924",
            "longitude": "108.317102"
          },
          {
            "id": "1005",
            "parentId": "1",
            "country": "良庆区",
            "latitude": "22.753563",
            "longitude": "108.323122"
          },
          {
            "id": "1006",
            "parentId": "1",
            "country": "邕宁区",
            "latitude": "22.756532",
            "longitude": "108.484648"
          },
          {
            "id": "1007",
            "parentId": "1",
            "country": "武鸣区",
            "latitude": "23.157105",
            "longitude": "108.233609"
          },
          {
            "id": "1008",
            "parentId": "1",
            "country": "隆安县",
            "latitude": "23.175039",
            "longitude": "107.682507"
          },
          {
            "id": "1009",
            "parentId": "1",
            "country": "马山县",
            "latitude": "23.708155",
            "longitude": "108.174592"
          },
          {
            "id": "1010",
            "parentId": "1",
            "country": "上林县",
            "latitude": "23.431762",
            "longitude": "108.602696"
          },
          {
            "id": "1011",
            "parentId": "1",
            "country": "宾阳县",
            "latitude": "23.216705",
            "longitude": "108.817136"
          },
          {
            "id": "1012",
            "parentId": "1",
            "country": "横县",
            "latitude": "22.685212",
            "longitude": "109.271262"
          }
        ]
      },
    ],
    span: 6,
    optionProps: {
      value: "id",
      label: "country",
      children: "children",
      leaf: "leaf",
      multiple: true,
      checkStrictly: false,
    },
    collapse: true,
    lastLevel: true,
  },
  // 搜索重置按钮
  {
    type: "slotName",
    slotName: "search",
    span: 6,
  },
];

// 新增编辑表单配置项
export const addFormConfig = [
  {
    label: "正整数",
    prop: "specialistName1",
    type: "positiveInteger",
    maxlength: 10,
    require: true,
    span: 12
  },
  {
    label: "两位小数",
    prop: "specialistName2",
    type: "floatNumber2",
    maxlength: 10,
    require: true,
    span: 12
  },
  {
    label: "三位小数",
    prop: "specialistName",
    type: "floatNumber3",
    maxlength: 10,
    require: true,
    span: 12
  },
  {
    label: "手机号",
    prop: "specialistPhone",
    type: "phoneNum",
    require: true,
    maxlength: 11,
    span: 12
  },
  {
    label: "身份证",
    prop: "specialistPhone1",
    type: "IDcard",
    require: true,
    maxlength: 18,
    span: 12
  },

  {
    label: "细分品类",
    prop: "SPES",
    type: "select",
    span: 12,
    options: [
      {
        "label": "水果",
        "value": "1",
      },
      {
        "label": "蔬菜",
        "value": "2",
      },
    ],
    require: false,
    multiple: true,
    labelValue: {
      label: "dictLabel",
      value: "dictValue",
    },
  },
  {
    label: "服务区域",
    prop: "SERVD",
    type: "defaultCascader",
    options: [
      {
        "id": "1",
        "parentId": "0",
        "country": "南宁市",
        "latitude": null,
        "longitude": null,
        "children": [
          {
            "id": "1001",
            "parentId": "1",
            "country": "兴宁区",
            "latitude": "22.857452",
            "longitude": "108.324052"
          },
          {
            "id": "1002",
            "parentId": "1",
            "country": "青秀区",
            "latitude": "22.819611",
            "longitude": "108.371708"
          },
          {
            "id": "1003",
            "parentId": "1",
            "country": "江南区",
            "latitude": "22.779909",
            "longitude": "108.274538"
          },
          {
            "id": "1004",
            "parentId": "1",
            "country": "西乡塘区",
            "latitude": "22.856924",
            "longitude": "108.317102"
          },
          {
            "id": "1005",
            "parentId": "1",
            "country": "良庆区",
            "latitude": "22.753563",
            "longitude": "108.323122"
          },
          {
            "id": "1006",
            "parentId": "1",
            "country": "邕宁区",
            "latitude": "22.756532",
            "longitude": "108.484648"
          },
          {
            "id": "1007",
            "parentId": "1",
            "country": "武鸣区",
            "latitude": "23.157105",
            "longitude": "108.233609"
          },
          {
            "id": "1008",
            "parentId": "1",
            "country": "隆安县",
            "latitude": "23.175039",
            "longitude": "107.682507"
          },
          {
            "id": "1009",
            "parentId": "1",
            "country": "马山县",
            "latitude": "23.708155",
            "longitude": "108.174592"
          },
          {
            "id": "1010",
            "parentId": "1",
            "country": "上林县",
            "latitude": "23.431762",
            "longitude": "108.602696"
          },
          {
            "id": "1011",
            "parentId": "1",
            "country": "宾阳县",
            "latitude": "23.216705",
            "longitude": "108.817136"
          },
          {
            "id": "1012",
            "parentId": "1",
            "country": "横县",
            "latitude": "22.685212",
            "longitude": "109.271262"
          }
        ]
      },
    ],
    span: 12,
    optionProps: {
      value: "id",
      label: "country",
      children: "children",
      leaf: "leaf",
      multiple: true,
      checkStrictly: false,
    },
    collapse: true,
    lastLevel: true,
  },
  {
    label: "性别",
    prop: "specialistGender",
    type: "autoSelect",
    span: 12,
    apiUrl: () =>
      request({
        url: `/system/dict/data/type/sys_user_sex`,
        method: "get",
      }),
    placeholder: "请选择性别",
    require: false,
    multiple: false,
    labelValue: {
      label: "dictLabel",
      value: "dictValue",
    },
  },
  {
    label: "内容",
    prop: "content",
    placeholder: "请输入标题",
    type: "editor",
    fileSize: 10,
    span: 24,
    maxlength: 20000,
  },
  // {
  //   label: "头像",
  //   prop: "specialistUrls",
  //   type: "upload",
  //   btnType: "picture-card",
  //   accept: ".jpg,.jpeg,.png",
  //   tip: "支持扩展名：jpg、jpeg、png，最多支持1张图片",
  //   maxlength: 1,
  //   disabled: false,
  //   span: 24,
  // },
  {
    label: "简介",
    prop: "introduce",
    type: "textarea",
    rows: 4,
    maxlength: 500,
    disabled: false,
    span: 24
  },
];
//验证
export const addRules = {
};